fix(bindeps): do not propagate artifact dependency to proc macro or build deps #15788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for the pull request 🎉!
Please read the contribution guide: https://doc.crates.io/contrib/.
What does this PR try to resolve?
This PR fixes a bug for the nightly feature
bindeps
. Basically, iffoo
has an artifact dependencyartifact
with a specified target TARGET_ARTIFACT different from host TARGET_HOST,artifact
depends on proc macromacro
,macro
conditionally depends onarch
on TARGET_HOST,cargo build would panic on TARGET_HOST with the following error message:
Similar panic happens when
foo
has an artifact dependencyartifact
with a specified target TARGET_ARTIFACT different from host TARGET_HOST,artifact
has a build dependencybuilder
,builder
conditionally depends onarch
on TARGET_HOST.From the above message, it is clear that proc macro
macro
was wrongly associated withFeaturesFor::ArtifactDep
instead ofFeaturesFor::HostDep
. Packagearch
was later ignored because cargo thoughtmacro
should be built for TARGET_ARTIFACT (x86_64-apple-darwin), whilearch
was conditionally needed on TARGET_HOST (aarch64-apple-darwin).Similar analyses apply to the other test case.
This commit fixes 2 paths:
FeaturesFor::HostDep
.How to test and review this PR?
This PR contains 2 commits
#[should_panic]
#[should_panic]
from the 2 test cases.cargo test
can pass on each commit.